Ext.define('Admin.view.trade.PowerGridPlanListdetail', {
    extend : 'Admin.form.DetailForm',
    alias : 'widget.powergridplanlistdetail',
    id:'powergridplanlistdetail',
    width:1000,
    height:600,
    controller:'powergridplanlist',
    autoScroll : true,
    renderTo: Ext.getBody(),
    title: '',
    bodyStyle: 'padding:10px;',
	items:[{
				xtype:'button',
				algin:'right',
				width:300,
				ui : 'soft-green',
				iconCls : 'x-fa fa-plus-square fa-lg',
				text: "添加计划",
				handler: function(btn){
					var win = btn.ownerCt.ownerCt;
					var viewModel = win.getViewModel();
					var record = viewModel.get('record');
					var org = record.get('market');
					   var simple=btn.ownerCt;
			            //添加新的fieldSet
			            var org_fieldSet = new  Ext.form.FormPanel({ 
			                //column布局控件开始         
			                layout: 'column',
			                border: false,
			                items: [//组件开始
			                {
			                    columnWidth: .3,
			                    layout: 'form',
			                    border: false,
			                    format:'Y-m-d',
			                    items: [{
			                        //为空
			                        blankText: '日期不能为空',
			                        emptyText: '',
			                        triggerAction: 'all',
			                        allowBlank: false,
			                        editable: false,
			                        //为空                       
			                        xtype: 'xdatefield',
			                        fieldLabel: '日期',
			                        name:'datadate',
			                        anchor: '90%',
			                        value:new Date()
			                    }]
			                } //组件结束
					, 
			                {
			                    columnWidth: .3,
			                    layout: 'form',
			                    border: false,
			                    items: [{
					                xtype : 'combo',
					                fieldLabel : '售电类型',
					                allowBlank : false ,
					                store : new Ext.data.JsonStore({
					                	  type : 'api',
									      method  : 'get',
									      crul : 'rest/api/tradeWay/pid/',
									        proxy : {
										        type : 'api',
										        url : 'rest/api/tradeWay/pid/4'
									        },
			                              autoLoad:true,
			                              root : "root",
			                              fields: [ 'id','name' ]
					                      }),
									displayField : "name",
									valueField : "id",
									name:"tradeway",
			                    }]
			                } //组件结束
			, //按钮开始

			                {
			                    columnWidth: .3,
			                    layout: 'form',
			                    border: false,
			                    items: [{
			                        //为空
			                        triggerAction: 'all',
			                        //为空
			                        //xtype: 'hidden',
			                        xtype: 'textfield',
			                        fieldLabel: '电量',
			                        name:'value',
			                        anchor: '90%'
			                    }]
			                } //组件结束
						, //按钮开始
						  {
		                    columnWidth: .1,
		                    layout: 'form',
		                    border: false,
		                    items: [{
		                        //为空
		                        triggerAction: 'all',
		                        //xtype: 'hidden',
		                        xtype : "hidden",
		                        fieldLabel: '组织机构',
		                        name:'org',
		                        value:org,
		                        anchor: '90%'
		                    }]
		                } //组件结束
					, //按钮开始
			                {
			                    columnWidth: .1,
			                    layout: 'form',
			                    border: false,
			                    algin:'right',
			                    items: [{
			                     
			                        xtype: 'button',
			                        algin:'right',
			                        text: '删除',
			                        value: id,
			                        handler: function(obj){
			                            //删除一行
			                        	this.ownerCt.remove(this.ownerCt.ownerCt, false);
			                             
			                        }
			                    }]
			                } //按钮结束
			]
			                //column布局控件结束
			            
			            });
			           
			            //添加fieldSet
			            simple.add(org_fieldSet);
			        },
			        iconCls: 'blist'
				}
			
			]
	
	,
    doStandard: function(data){
        var json = {};
        for(var p in data){
            var idx = p.indexOf('.');
            if(idx != -1){   //如果属性名称包含.进行对象层次分隔
                this.process(data[ p ], p, json);
            } else {
                json[ p ] = data[ p ];
            }
        }
        return json;        
    }

	
});
